package cn.com.egova.demoapplication;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import cn.com.egova.demoapplication.base.BaseActivity;
import cn.com.egova.demoapplication.view.PointAnimView;

public class ComplexOneActivity extends BaseActivity {

    @InjectView(R.id.btn_start)
    Button btnStart;
    @InjectView(R.id.btn_pause)
    Button btnPause;
    @InjectView(R.id.btn_stop)
    Button btnStop;
    @InjectView(R.id.pointAnimViwe)
    PointAnimView pointAnimViwe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_complex_one);
        ButterKnife.inject(this);

        //Android 19以下不支持暂停动画的API.19以上不支持停止动画的API.
        if(Build.VERSION.SDK_INT<Build.VERSION_CODES.KITKAT){
            btnPause.setVisibility(View.GONE);
        }else{
            btnStop.setVisibility(View.GONE);
        }
    }

    @Override
    public boolean isBackIconVisible() {
        return true;
    }

    @OnClick({R.id.btn_start, R.id.btn_pause, R.id.btn_stop})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_start:
                pointAnimViwe.startAnimation();
                break;
            case R.id.btn_pause:
                pointAnimViwe.pauseAnimation();
                break;
            case R.id.btn_stop:
                pointAnimViwe.stopAnimation();
                break;
        }
    }
}
